package com.bomb.voice.feature.operationAccount;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.bigkoo.svprogresshud.SVProgressHUD;
import com.bomb.voice.R;
import com.bomb.voice.utils.AccountConfig;
import com.tbruyelle.rxpermissions.RxPermissions;

import rx.functions.Action1;

public class VoipActivity extends AppCompatActivity {
    private SVProgressHUD svProgressHUD;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_voip);
        RxPermissions.getInstance(this)
                .request(AccountConfig.REQUIRED_PERMISSIONS)
                .subscribe(new Action1<Boolean>() {
                    @Override
                    public void call(Boolean granted) {
                        if (granted) {
//                            initView();
                        } else {
                            Toast.makeText(VoipActivity.this, "请同意权限否则无法正常使用APP", Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }


   /* public void loginFy() {
        FYClient.addListener(new FYClientListener() {
            @Override
            public void onConnectionSuccessful() {
                svProgressHUD.showSuccessWithStatus("连接成功！输入号码开始拨打吧");
            }

            @Override
            public void onConnectionFailed(FYError fyError) {
                if (svProgressHUD.isShowing()) {
                    svProgressHUD.dismiss();
                }
                mAlertView.show();
            }
        });
        FYCall.addListener(new FYCallListener() {
            @Override
            public void onCallFailed(FYError fyError) {
                Toast.makeText(FaceTimeActivity.this, "onCallFailed" + fyError.msg, Toast.LENGTH_SHORT).show();
                recordInfo("onCallFailed 呼叫失败" + fyError.msg);
            }

            @Override
            public void onIncomingCall(String s) {
                Toast.makeText(FaceTimeActivity.this, "onIncomingCall" + s, Toast.LENGTH_SHORT).show();

            }

            @Override
            public void onOutgoingCall(String s) {
                Toast.makeText(FaceTimeActivity.this, "onOutgoingCall" + s, Toast.LENGTH_SHORT).show();
                recordInfo("外拨电话" + s);

            }

            @Override
            public void onCallRunning(String s) {
                Toast.makeText(FaceTimeActivity.this, "FYCall 正在通话" + s, Toast.LENGTH_SHORT).show();
                recordInfo("FYCall 正在通话" + s);
            }

            @Override
            public void onCallEnd() {
                Toast.makeText(FaceTimeActivity.this, "onCallEnd 通话结束", Toast.LENGTH_SHORT).show();
                recordInfo("onCallEnd 通话结束");

            }

            @Override
            public void onCallbackSuccessful() {
                Toast.makeText(FaceTimeActivity.this, "onCallbackSuccessful", Toast.LENGTH_SHORT).show();

            }

            @Override
            public void onCallbackFailed(FYError fyError) {
                Toast.makeText(FaceTimeActivity.this, "onCallbackFailed" + fyError.msg, Toast.LENGTH_SHORT).show();

            }

            @Override
            public void onCallAlerting(String s) {
                recordInfo("FYCall 对方正在振铃" + s);

            }

            @Override
            public void onDtmfReceived(char c) {
                Toast.makeText(FaceTimeActivity.this, "FYCall" + c, Toast.LENGTH_SHORT).show();
            }
        });

        FYClient.instance().connect(FY_APPID, FY_APPTOKEN, fyAccountId, fyAccountPwd);
        FYCall.instance().setMuteEnabled(false);//麦克风静音


    }*/

}
